<!--  -->
<template>
  <div class="box2">孙组件1
   {{ userInfo.name }}
  </div>
</template>

<script lang='ts' setup>
import { reactive,toRefs,ref,onMounted, inject} from 'vue'
const userInfo:any= inject("userInfo"); 

console.log("在孙组件接收到的数据",userInfo.value.name);


</script>
<style scoped>
.box2{
    width: 100%;
    height: 100px;
    background: yellow;
}
</style>